#!/usr/bin/env python
'''
dic字典排序
'''


def test_dic_sort_func():
    dic = {"a": "a", "f": "f", "c": "c", "b": "b"}

    # 遍历字典
    for it in dic.items():
        print(it[0],it[1])

    list_dic = sorted(dic.items(), key=lambda item: item[0], reverse=False)
    print(list_dic)
    dic = dict(list_dic)
    print(dic)


if __name__ == '__main__':
    test_dic_sort_func()
